<%@page language="java" pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>

		<title>My JSP 'roundSearchResult.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
		<script type="text/javascript"
			src="http://api.map.baidu.com/api?v=1.3"></script>
	</head>

	<body>
		<div>
			<div>
				<div style="width: 520px; height: 340px; border: 1px solid gray"
					id="mapContainer">
				</div>
			</div>
			<div>
				<div>
					<a href="roundSearch.do">重新搜索</a>
				</div>
				<div>
					<table>
					<tr>
						<td>
							信息类别
						</td>
						<td>
							出发城市
						</td>
						<td>
							出发点名称
						</td>
						<td>
							目的地
						</td>
						<td>
							目的点名称
						</td>
						<td>
							出发时间
						</td>
						<td>
							座位总数
						</td>
						<td>
							预订座位数
						</td>
					</tr>
					<c:forEach items="${informations.object}" var="information">
						<tr>
							<td>
								<c:choose>
									<c:when test="${information.type eq '01'}">
										车主发布
									</c:when>
									<c:when test="${information.type eq '02'}">
										乘客发布
									</c:when>
								</c:choose>
							</td>
							<c:forEach items="${information.addresses}" var="address">
								<c:if test="${address.type eq '01'}">
									<td>
										<c:out value="${address.city}"/>
									</td>
									<td>
										<c:out value="${address.pointName}"/>
									</td>	
								</c:if>
							</c:forEach>
							<c:forEach items="${information.addresses}" var="address">
								<c:if test="${address.type eq '03'}">
									<td>
										<c:out value="${address.city}"/>
									</td>
									<td>
										<c:out value="${address.pointName}"/>
									</td>	
								</c:if>
							</c:forEach>
							<td>
								<c:out value="${information.departureTime}"/>
							</td>
							<td>
								<c:out value="${information.seatNumber}"/>
							</td>
							<td>
								<c:out value="${information.bookedSeatNumber}"/>
							</td>
							<td>
								<a
								href="detailInformation.do?informationID=${information.informationId}">详细信息</a>
							</td>
						</tr>
						</c:forEach>
				</table>
				</div>
			</div>
		</div>
	</body>
</html>


<script type="text/javascript">
//出发地地图
	var departureMap = new BMap.Map("mapContainer");
	departureMap.centerAndZoom(new BMap.Point(116.404, 39.915), 12);
	departureMap.addControl(new BMap.NavigationControl());
	departureMap.addControl(new BMap.ScaleControl());
	departureMap.addControl(new BMap.OverviewMapControl());
	departureMap.enableScrollWheelZoom();
	
	var centerX="${x}";
	var centerY="${y}";
	var centerPoint=new BMap.Point(centerX,centerY);
	departureMap.setCenter(centerPoint);

		<c:forEach items="${informations.object}" var="information" varStatus="status">
			<c:forEach items="${information.addresses}" var="address">
				<c:if test="${address.type == '01'}">
					var x = "${address.x}";
					var y = "${address.y}";
					var city = "${address.city}";
				</c:if>
			</c:forEach>
			var point = new BMap.Point(x, y)
			var marker = new BMap.Marker(point);
			var label = new BMap.Label("${status.index}");
			marker.setLabel(label);
  			departureMap.addOverlay(marker);
		</c:forEach>
		
</script>